package notificacionesuno.beans.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import notificacionesuno.conexion.factory.Connection;

public class Transacciones {

    public static ResultSet consultar(String sql) {
        try {
            java.sql.Connection connectDB = Connection.connectDB();
            if (connectDB != null) {
                Statement statement = connectDB.createStatement();
                ResultSet resultset = statement.executeQuery(sql);
                return resultset;
            }
        } catch (SQLException ex) {
            Logger.getLogger(Transacciones.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

    public static int insertarActualizar(String sql) {
        try {
            java.sql.Connection connectDB = Connection.connectDB();
            if (connectDB != null) {
                Statement statement = connectDB.createStatement();
                int resultset = statement.executeUpdate(sql);
                return resultset;
            }
        } catch (SQLException ex) {
            Logger.getLogger(Transacciones.class.getName()).log(Level.SEVERE, null, ex);
        }
        return -1;
    }
}